<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Provisioning: New Order</title>
    </h:head>
    <h:body>
        <h:panelGroup rendered="#{userSessionBean.loggedIn}">
        <div style="text-align: center; width:100%;">
            <p:panel header="Order Form" style="width: 450px; display: inline-block; text-align: left;">
                <h:form>
                    <h:panelGrid columns="2" cellpadding="2">
                        <h:outputLabel value="Source Router Name"/>
                        <p:autoComplete value="#{orderBean.sourceRouterName}" rendered="true" completeMethod="#{routerBean.listByName}" maxResults="10"/>
                        <h:outputLabel value="Destination Router ID"/>
                        <p:autoComplete value="#{orderBean.destinationRouterName}" required="true" completeMethod="#{routerBean.listByName}" maxResults="10"/>
                        <h:outputLabel value="Required Bandwith (kbit/s)"/>
                        <p:inputText value="#{orderBean.bandwidth}" required="true"/>
                        <h:outputLabel value="Comment"/>
                        <p:inputText value="#{orderBean.comment}"/>
                        <h:button value="Return to dashboard" outcome="welcome?faces-redirect=true"/>
                        <h:commandButton action="#{orderBean.makeOrder(userSessionBean)}" value="Make Order"/>
                    </h:panelGrid>
                </h:form>
                <h:messages/>
            </p:panel>
        </div>
        </h:panelGroup>
        <h:panelGroup rendered="#{!userSessionBean.loggedIn}">
            You are not authorized to perform this operation. Please, <h:link outcome="index?faces-redirect=true" value="log in"/>.
        </h:panelGroup>
    </h:body>
</html>
